Skip to content

fix(ci,jni): install Rust Android targets before JNI builds#28

Merged
TriForMine merged 1 commit into
mainfrom
feat/phase5-expo-scanner-bridge
May 28, 2026
Merged

fix(ci,jni): install Rust Android targets before JNI builds#28
TriForMine merged 1 commit into
mainfrom
feat/phase5-expo-scanner-bridge

Conversation

@TriForMine

@TriForMine TriForMine commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Chores

  • Improved Android build process by ensuring required compilation targets are available during the build.
  • Added stricter error handling in Android builds to prevent incomplete artifacts.
  • Enhanced web platform dependencies for improved compatibility.

Review Change Stack

Copilot AI review requested due to automatic review settings May 28, 2026 20:50
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds infrastructure improvements to support building GlyphNet for Android JNI and WASM targets. Rust Android compilation targets are now installed in the CI workflow and local build script, artifact upload is configured to fail on missing JNI libraries, and the WASM crate now explicitly depends on the instant crate with wasm-bindgen feature enabled.

Changes

Build Target Installation and Dependencies

Layer / File(s) Summary
Android JNI target installation
.github/workflows/android-jni.yml, apps/expo-glyphnet/scripts/build-glyphnet-jni-android.sh
The CI workflow and local build script now both install required Rust Android targets (aarch64, armv7, x86_64) via rustup target add, and the CI artifact upload is configured to error when expected JNI library files are missing.
WASM instant crate dependency
crates/glyphnet-wasm/Cargo.toml
The instant crate is explicitly added as a wasm32 target-specific dependency with the wasm-bindgen feature enabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through targets bright,
Android arms now build just right,
WASM whispers "instant" true,
Build infrastructure, fresh and new! 🏗️✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: installing Rust Android compilation targets before JNI builds in CI workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/phase5-expo-scanner-bridge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions

Copy link
Copy Markdown

Burst reliability (loss sweep)

PR gate status: PASS

  • Gating rows: 4 pass / 0 fail
  • Non-gating rows: none
Drop rate Gating PR success Base success Delta PR median frames Base median frames
10% Yes 100.0% 100.0% 0.0pp 14 14
20% Yes 100.0% 100.0% 0.0pp 16 16
30% Yes 100.0% 100.0% 0.0pp 19 19
40% Yes 50.0% 50.0% 0.0pp 18 18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
crates/glyphnet-wasm/Cargo.toml (1)

29-29: ⚡ Quick win

Update on instant dependency (version + security)

  • instant pinned to 0.1.13 is the latest crates.io release.
  • No known RustSec security advisories are reported for instant 0.1.13.
  • instant is marked unmaintained (RustSec RUSTSEC-2024-0384) and recommends migrating to web-time; consider whether you want to take that maintenance risk and/or add cargo-audit to catch future advisories.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/glyphnet-wasm/Cargo.toml` at line 29, The Cargo.toml currently pins
the unmaintained dependency "instant" (instant = { version = "0.1.13", features
= ["wasm-bindgen"] }) which is flagged by RUSTSEC-2024-0384; either migrate to
the recommended maintained crate "web-time" (replace the Cargo.toml entry,
update feature flags as needed, and update all code references from
instant::Instant (or instant::now()) to web_time::Instant / web_time::now()) or
explicitly document/accept the maintenance risk and add cargo-audit as a
dev-dependency to detect future advisories (add cargo-audit to
[dev-dependencies] and CI). Ensure you update import paths and any API
differences in functions/classes that used instant so builds and tests pass.
apps/expo-glyphnet/scripts/build-glyphnet-jni-android.sh (1)

14-16: 💤 Low value

Consider consistent error handling for missing build tools.

The script exits gracefully (exit 0 with WARNING) when cargo or cargo-ndk is missing, but will fail hard if rustup target add fails. This inconsistency may surprise developers who expect the same graceful degradation behavior.

If the intent is to skip JNI builds when any build tool is unavailable or misconfigured, consider wrapping the rustup command with similar error handling. If the intent is to fail when tools are present but misconfigured, the current behavior is correct.

🔄 Optional: Add consistent error handling
 echo "Ensuring Rust Android targets are installed..."
-rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
+if ! rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android; then
+  echo "WARNING: Failed to install Rust Android targets. Skipping GlyphNet JNI build."
+  exit 0
+fi

Note: Only apply this if graceful degradation for all missing tools is the intended behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/expo-glyphnet/scripts/build-glyphnet-jni-android.sh` around lines 14 -
16, The rustup target installation step (rustup target add aarch64-linux-android
armv7-linux-androideabi x86_64-linux-android) currently fails hard while earlier
checks for cargo/cargo-ndk exit gracefully; update the script so the rustup
command's failure is handled consistently — run rustup target add, capture its
exit status, and if it fails echo a WARNING describing the failure (include
stderr) and exit 0 to skip JNI builds (or exit nonzero if you prefer hard
failure), mirroring the existing cargo/cargo-ndk error handling pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/expo-glyphnet/scripts/build-glyphnet-jni-android.sh`:
- Around line 14-16: The rustup target installation step (rustup target add
aarch64-linux-android armv7-linux-androideabi x86_64-linux-android) currently
fails hard while earlier checks for cargo/cargo-ndk exit gracefully; update the
script so the rustup command's failure is handled consistently — run rustup
target add, capture its exit status, and if it fails echo a WARNING describing
the failure (include stderr) and exit 0 to skip JNI builds (or exit nonzero if
you prefer hard failure), mirroring the existing cargo/cargo-ndk error handling
pattern.

In `@crates/glyphnet-wasm/Cargo.toml`:
- Line 29: The Cargo.toml currently pins the unmaintained dependency "instant"
(instant = { version = "0.1.13", features = ["wasm-bindgen"] }) which is flagged
by RUSTSEC-2024-0384; either migrate to the recommended maintained crate
"web-time" (replace the Cargo.toml entry, update feature flags as needed, and
update all code references from instant::Instant (or instant::now()) to
web_time::Instant / web_time::now()) or explicitly document/accept the
maintenance risk and add cargo-audit as a dev-dependency to detect future
advisories (add cargo-audit to [dev-dependencies] and CI). Ensure you update
import paths and any API differences in functions/classes that used instant so
builds and tests pass.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 306ae3b9-730a-4b49-80eb-716da6546c2f

📥 Commits

Reviewing files that changed from the base of the PR and between f6e2ee6 and ddca839.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • .github/workflows/android-jni.yml
  • apps/expo-glyphnet/scripts/build-glyphnet-jni-android.sh
  • crates/glyphnet-wasm/Cargo.toml

@TriForMine TriForMine merged commit b82d70e into main May 28, 2026
10 of 12 checks passed
@TriForMine TriForMine deleted the feat/phase5-expo-scanner-bridge branch May 28, 2026 20:55
@github-actions

Copy link
Copy Markdown

Scanner perf (ribbon + matrix fixtures)

PR gate status: PASS

  • Ribbon budget: 25.000 ms (allowed 75.000 ms)
  • Matrix budget: 20.000 ms (allowed 60.000 ms)
  • Tolerance: 200.0%
  • Ribbon gating benches: 3 pass / 0 fail
  • Matrix gating benches: 1 pass / 0 fail
Benchmark Gating PR median (ms) Base median (ms) Delta (ms) Delta %
scan_generated_ribbon_canvas_small (RibbonPrint) Yes 47.832 47.883 -0.051 -0.11%
scan_generated_ribbon_canvas_medium (RibbonPrint) Yes 7.152 7.143 0.010 0.13%
scan_generated_ribbon_canvas_large (RibbonPrint) Yes 25.759 25.762 -0.002 -0.01%
scan_generated_matrix_roi (MatrixCompat) Yes 3.033 3.031 0.002 0.06%
scan_generated_matrix_canvas (MatrixCompat) No 183.273 183.220 0.053 0.03%
scan_real_debugger_screenshot (RibbonPrint) No 283.889 281.916 1.973 0.70%

Matrix subset

Benchmark Gating PR median (ms) Base median (ms) Delta (ms) Delta %
scan_generated_matrix_roi (MatrixCompat) Yes 3.033 3.031 0.002 0.06%
scan_generated_matrix_canvas (MatrixCompat) No 183.273 183.220 0.053 0.03%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants